{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1. Running ado.file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "qui do \"https://raw.githubusercontent.com/worldbank/Stata-IE-Visual-Library/develop/Library/Charts/Chart%20of%20marginal%20effect%20with%20results%20table%20using%20excel/chartable.ado\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. Uploading data\n",
    "```chartable``` generates a chart of primary regression results for a variable list, combined with a table detailing those results."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "use \"https://github.com/worldbank/Stata-IE-Visual-Library/raw/develop/Library/Charts/Chart%20of%20marginal%20effect%20with%20results%20table%20using%20excel/data.dta\", clear"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3. Creating graph, and exporting the graph data to excel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(0 observations deleted)\n"
     ]
    }
   ],
   "source": [
    "chartable correct cxr sputum s5_referral sp_drugs_tb sp_drugs_antibio sp_drugs_quin ///\n",
    "\tusing \"figure.xlsx\" ///\n",
    "\t, \tc(xi: firthlogit) rhs(q_mbbs pro_age pro_male patients_waiting_in i.sp_id) or p globalif"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4. Exporting the graph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "qui graph export \"figure.png\" , width(4000) replace"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Stata",
   "language": "stata",
   "name": "stata"
  },
  "language_info": {
   "file_extension": ".do",
   "mimetype": "text/x-stata",
   "name": "stata"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
